<template>
  <view class="container">
    <view class="tab_nav">
      <nav-bar
        nav_btn="back"
        :index="index"
        @onPicker="getPicker"
        :title="title"
        :showPicker="showPicker"
        :color="color"
        :placeholder="placeholder"
        :list="list"
        :auto_img="image"
        :background="background"
      ></nav-bar>
    </view>
    <view class="item" @click="navigator('czdetail', 0)">
      <view class="left">
        <image
          src="@/static/memberManage1.png"
          style="width: 70rpx; height: 70rpx"
        ></image>
      </view>
      <view class="center">会员充值详情</view>
      <view class="right">
        <uni-icons
          type="right"
          size="16"
          color="#666"
          style="font-weight: bold"
        ></uni-icons>
      </view>
    </view>
    <view class="item" @click="navigator('czTiaozheng', 1)">
      <view class="left">
        <image
          src="@/static/memberManage2.png"
          style="width: 70rpx; height: 70rpx"
        ></image>
      </view>
      <view class="center">充值提前到账审核</view>
      <view class="right">
        <uni-badge :text="objData.dz" type="error" size="normal" :max-num="99" />
        <uni-icons
          type="right"
          size="16"
          color="#666"
          style="font-weight: bold"
        ></uni-icons>
      </view>
    </view>
    <view class="item" @click="navigator('czTiaozheng', 2)">
      <view class="left">
        <image
          src="@/static/memberManage3.png"
          style="width: 70rpx; height: 70rpx"
        ></image>
      </view>
      <view class="center">订单充值调整审核</view>
      <view class="right">
        <uni-badge :text="objData.cz" type="error" size="normal" :max-num="99" />
        <uni-icons
          type="right"
          size="16"
          color="#666"
          style="font-weight: bold"
        ></uni-icons>
      </view>
    </view>
  </view>
</template>

<script>
export default {
  data() {
    return {
      shopId: 0,
      index: 0,
      list: [],
      showPicker: true,
      backgrond: "#999999",
      image: "../static/tab_jian.png",
      color: "#000",
      objData: {},
    };
  },
  onLoad(option) {
    this.shopId = option.shopId;
    this.index = option.index;
    this.getShopList();
    this.getNotice();
  },
  methods: {
    getShopList() {
      this.$request({
        url: "wedding/shop_list",
        method: "POST",
        data: {
          keyword: "",
          type: 1,
        },
      }).then((res) => {
        this.list = res.data.data;
        // this.shopId = res.data.data[0].id
        // this.title = res.data.data[0].shopname
      });
    },
    // 获取消息来判断是否显示消息提示
    getNotice() {
      this.$request({
        url: "manage/getnotice",
        method: "post",
        data: {
          shop_id: this.shopId,
          type: "recharge",
        },
      }).then((res) => {
        const { code, data } = res.data;
        if (code == 1) {
          this.objData = data;
        }
      });
    },
    getPicker(e) {
      this.shopId = this.list[e].id;
      this.index = e;
      uni.setStorageSync("shopId", this.list[e].id);
			this.getNotice();
    },
    navigator(url, idx, type) {
      uni.navigateTo({
        url:
          "./" +
          url +
          "?type=" +
          idx +
          "&index=" +
          this.index +
          "&shopId=" +
          this.shopId,
      });
    },
  },
};
</script>

<style lang="scss">
.container {
  width: 100%;
}
.item {
  padding: 32rpx;
  border-bottom: 1px solid #f4f4f4;
  padding-bottom: 30rpx;
  display: flex;
  align-items: center;
  .left {
    width: 100rpx;
    image {
      vertical-align: top;
    }
  }
  .center {
    flex: 1;
    font-size: 32rpx;
    color: #333333;
  }
  .right {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    width: 100rpx;
    text-align: center;
    .uni-badge--x {
      vertical-align: top;
    }
  }
}
</style>
